/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.Kernel;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;

import edu.pku.sei.modeler.model.uml.Nodes.Deployment;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;


/**
 * @generated
 *
 */
public class InstanceSpecification extends PackageableElement implements IInstanceSpecification {
	// attributes
	
	
	
	
	// references
	
	protected MetaTypedList slot;
	
	protected MetaTypedList specification;
	
	protected MetaTypedList classifier;
	
	
	
	protected MetaTypedList deployedElement;
	
	protected MetaTypedList deployment;
	
	// getters & setters for attributes
	
	// getters for references
	
	public MetaTypedList getSlot() {
		if(slot == null) {
			slot = new MetaTypedList(Slot.class, this, ModelPackage.INSTANCESPECIFICATION_SLOT);
		}
		return slot;
	}
	
	public MetaTypedList getSpecification() {
		if(specification == null) {
			specification = new MetaTypedList(ValueSpecification.class, this, ModelPackage.INSTANCESPECIFICATION_SPECIFICATION);
		}
		return specification;
	}
	
	public MetaTypedList getClassifier() {
		if(classifier == null) {
			classifier = new MetaTypedList(Classifier.class, this, ModelPackage.INSTANCESPECIFICATION_CLASSIFIER);
		}
		return classifier;
	}
	
	public MetaTypedList getDeployedElement() {
		if(deployedElement == null) {
			deployedElement = new MetaTypedList(PackageableElement.class, this, ModelPackage.DEPLOYMENTTARGET_DEPLOYEDELEMENT);
		}
		return deployedElement;
	}
	
	public MetaTypedList getDeployment() {
		if(deployment == null) {
			deployment = new MetaTypedList(Deployment.class, this, ModelPackage.DEPLOYMENTTARGET_DEPLOYMENT);
		}
		return deployment;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		// references
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.INSTANCESPECIFICATION_SLOT, slot);
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.INSTANCESPECIFICATION_SPECIFICATION, specification);
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.INSTANCESPECIFICATION_CLASSIFIER, classifier);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.DEPLOYMENTTARGET_DEPLOYEDELEMENT, deployedElement);		
		
		XMLUtility.xmlInstance.serializeNodes(root, ModelPackage.DEPLOYMENTTARGET_DEPLOYMENT, deployment);
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		// references
		
		this.getSlot().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.INSTANCESPECIFICATION_SLOT));
		
		this.getSpecification().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.INSTANCESPECIFICATION_SPECIFICATION));
		
		this.getClassifier().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.INSTANCESPECIFICATION_CLASSIFIER, this));
		
		this.getDeployedElement().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.DEPLOYMENTTARGET_DEPLOYEDELEMENT, this));
		
		this.getDeployment().addAll(XMLUtility.xmlInstance.deSerializeNodes(root, ModelPackage.DEPLOYMENTTARGET_DEPLOYMENT));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		// references
		
		else if(ModelPackage.INSTANCESPECIFICATION_CLASSIFIER.equals(featureID)) {
			getClassifier().add(value);
		}
		
		else if(ModelPackage.DEPLOYMENTTARGET_DEPLOYEDELEMENT.equals(featureID)) {
			getDeployedElement().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 